From ef7f580f99a11c56f683f88f30536f07b3cfedc0 Mon Sep 17 00:00:00 2001 From: robertlipe Date: Mon, 17 Feb 2014 06:35:06 +0000 Subject: [PATCH] Simple changes for uninteresting non-problems. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4748 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/csv_util.cc | 2 +- gpsbabel/exif.cc | 2 +- gpsbabel/mmo.cc | 2 +- gpsbabel/unicsv.cc | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gpsbabel/csv_util.cc b/gpsbabel/csv_util.cc index d1531ea0c..7c6b208d6 100644 --- a/gpsbabel/csv_util.cc +++ b/gpsbabel/csv_util.cc @@ -918,7 +918,7 @@ addhms(const char* s, const char* format) char* ampm = NULL; int ac; - ampm = (char*) xmalloc(strlen(s)); + ampm = (char*) xmalloc(strlen(s) + 1); ac = sscanf(s, format, &hour, &min, &sec, &m); /* If no time format in arg string, assume AM */ if (ac < 4) { diff --git a/gpsbabel/exif.cc b/gpsbabel/exif.cc index cbb751d55..56875e88e 100644 --- a/gpsbabel/exif.cc +++ b/gpsbabel/exif.cc @@ -1278,7 +1278,7 @@ exif_write_apps(void) len += 4; /* DWORD(0) after last ifd */ - if ((tag = exif_find_tag(app, IFD1, IFD1_TAG_JPEG_OFFS))) { + if ((exif_find_tag(app, IFD1, IFD1_TAG_JPEG_OFFS))) { exif_put_long(IFD1, IFD1_TAG_JPEG_OFFS, 0, len); } diff --git a/gpsbabel/mmo.cc b/gpsbabel/mmo.cc index 17f5c54e8..5668af700 100644 --- a/gpsbabel/mmo.cc +++ b/gpsbabel/mmo.cc @@ -629,7 +629,7 @@ mmo_read_CObjRoute(mmo_data_t* data) DBG((sobj, "read next waypoint\n")); tmp = mmo_read_object(); - if (tmp && tmp->data && (tmp->type = wptdata)) { + if (tmp && tmp->data && (tmp->type == wptdata)) { Waypoint* wpt; /* FIXME: At this point this waypoint maybe not fully loaded (initialized) !!! diff --git a/gpsbabel/unicsv.cc b/gpsbabel/unicsv.cc index 7b73b29fd..d73ed1150 100644 --- a/gpsbabel/unicsv.cc +++ b/gpsbabel/unicsv.cc @@ -639,6 +639,7 @@ unicsv_parse_one_line(char* ibuf) double utm_easting = 0; double utm_northing = 0; char utm_zc = 'N'; + // Zones are always two bytes. Spare one for null termination.. char bng_zone[3] = ""; double bng_easting = 0; double bng_northing = 0; @@ -761,7 +762,7 @@ unicsv_parse_one_line(char* ibuf) break; case fld_bng_zone: - strncpy(bng_zone, s, sizeof(bng_zone)); + strncpy(bng_zone, s, sizeof(bng_zone) -1 ); strupper(bng_zone); break; -- 2.30.2